<html>
<head><meta charset="utf-8"><title>Naming bikeshed: how to merge ranges? · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Naming.20bikeshed.3A.20how.20to.20merge.20ranges.3F.html">Naming bikeshed: how to merge ranges?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="189023492"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Naming%20bikeshed%3A%20how%20to%20merge%20ranges%3F/near/189023492" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Naming.20bikeshed.3A.20how.20to.20merge.20ranges.3F.html#189023492">(Feb 25 2020 at 14:27)</a>:</h4>
<p><a href="https://github.com/rust-analyzer/text_unit/pull/1" target="_blank" title="https://github.com/rust-analyzer/text_unit/pull/1">https://github.com/rust-analyzer/text_unit/pull/1</a></p>
<p>What's the name of the operation that computes the least range containing two given ranges?</p>



<a name="189023719"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Naming%20bikeshed%3A%20how%20to%20merge%20ranges%3F/near/189023719" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Naming.20bikeshed.3A.20how.20to.20merge.20ranges.3F.html#189023719">(Feb 25 2020 at 14:29)</a>:</h4>
<p>Options:</p>
<ul>
<li>union -- most obvious, but also obviously wrong, a union of ranges is not necessary a range</li>
<li>convex hull -- pedantically correct, but overly generic </li>
<li>covering_range -- somewhat unclear</li>
<li>???</li>
</ul>



<a name="189023811"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Naming%20bikeshed%3A%20how%20to%20merge%20ranges%3F/near/189023811" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Naming.20bikeshed.3A.20how.20to.20merge.20ranges.3F.html#189023811">(Feb 25 2020 at 14:30)</a>:</h4>
<ul>
<li>cover?</li>
</ul>



<a name="189023843"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Naming%20bikeshed%3A%20how%20to%20merge%20ranges%3F/near/189023843" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Naming.20bikeshed.3A.20how.20to.20merge.20ranges.3F.html#189023843">(Feb 25 2020 at 14:30)</a>:</h4>
<ul>
<li>a.extend_to(b)</li>
</ul>



<a name="189024179"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Naming%20bikeshed%3A%20how%20to%20merge%20ranges%3F/near/189024179" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Emil Lauridsen <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Naming.20bikeshed.3A.20how.20to.20merge.20ranges.3F.html#189024179">(Feb 25 2020 at 14:34)</a>:</h4>
<p><code>extend_to</code> doesn't seem too bad. Might be a little confusing as it implies some sense of "direction", but not sure that's a big deal</p>



<a name="189025129"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Naming%20bikeshed%3A%20how%20to%20merge%20ranges%3F/near/189025129" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Edwin Cheng <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Naming.20bikeshed.3A.20how.20to.20merge.20ranges.3F.html#189025129">(Feb 25 2020 at 14:45)</a>:</h4>
<ul>
<li>merge</li>
</ul>



<a name="189025282"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Naming%20bikeshed%3A%20how%20to%20merge%20ranges%3F/near/189025282" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Edwin Cheng <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Naming.20bikeshed.3A.20how.20to.20merge.20ranges.3F.html#189025282">(Feb 25 2020 at 14:47)</a>:</h4>
<p>If others understand this zulip topic, it should be named to <code>merge</code> tautologically :)</p>



<a name="189025287"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Naming%20bikeshed%3A%20how%20to%20merge%20ranges%3F/near/189025287" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Naming.20bikeshed.3A.20how.20to.20merge.20ranges.3F.html#189025287">(Feb 25 2020 at 14:47)</a>:</h4>
<ul>
<li>bounding_box</li>
</ul>



<a name="189025296"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Naming%20bikeshed%3A%20how%20to%20merge%20ranges%3F/near/189025296" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Naming.20bikeshed.3A.20how.20to.20merge.20ranges.3F.html#189025296">(Feb 25 2020 at 14:47)</a>:</h4>
<ul>
<li>bounding_range</li>
</ul>



<a name="189025378"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Naming%20bikeshed%3A%20how%20to%20merge%20ranges%3F/near/189025378" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Edwin Cheng <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Naming.20bikeshed.3A.20how.20to.20merge.20ranges.3F.html#189025378">(Feb 25 2020 at 14:48)</a>:</h4>
<p><code>extend_to</code> and <code>bounding_range</code> are both good to me.</p>



<a name="189025460"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Naming%20bikeshed%3A%20how%20to%20merge%20ranges%3F/near/189025460" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Naming.20bikeshed.3A.20how.20to.20merge.20ranges.3F.html#189025460">(Feb 25 2020 at 14:49)</a>:</h4>
<p>Let's pick extend_to: it looks better as a method, though, for a free function, bounding_range would be a better choice</p>



<a name="189025764"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Naming%20bikeshed%3A%20how%20to%20merge%20ranges%3F/near/189025764" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremy Kolb <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Naming.20bikeshed.3A.20how.20to.20merge.20ranges.3F.html#189025764">(Feb 25 2020 at 14:53)</a>:</h4>
<p>If you want to be explicit I think <code>extend_to_cover</code> would save me from using a hover.  An alternative would be a constructor that takes two ranges</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>